package com.cdtye.shuoh.service.rule.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdtye.shuoh.domain.rule.entity.RuleConditions;
import com.cdtye.shuoh.domain.rule.vo.RuleConditionsVo;
import com.cdtye.shuoh.mapper.rule.RuleConditionsMapper;
import com.cdtye.shuoh.service.rule.RuleConditionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RuleConditionsServiceImpl extends ServiceImpl<RuleConditionsMapper, RuleConditions> implements RuleConditionsService {

    @Autowired
    private RuleConditionsMapper ruleConditionsMapper;


    @Override
    public IPage<RuleConditions> pageList(RuleConditionsVo vo) {
        return ruleConditionsMapper.pageList(vo.page(),vo);
    }

    @Override
    public List<RuleConditions> list(RuleConditionsVo vo) {
        return ruleConditionsMapper.list(vo);
    }

    @Override
    public boolean deleteByRuleIdentification(String ruleIdentification) {
        QueryWrapper<RuleConditions> wrapper = new QueryWrapper<>();
        wrapper.eq("RULE_IDENTIFICATION",ruleIdentification);
        return this.remove(wrapper);
    }

    @Override
    public boolean deleteRuleConditionById(String id) {
        return removeById(id);
    }
}
